<template>
  <div>
    <h2>Home</h2>
     router-link中to的字符串写法,只能书写路由地址
    <router-link to="/home/news">news</router-link>
    <router-link to="/home/music">music</router-link>

     <!-- router-link中to的对象写法 可以通过path属性来设置路由地址
    <router-link
      :to="{
        path: '/home/music',
      }"
      >music</router-link
    >
    <router-link
      :to="{
        path: '/home/news',
      }"
      >news</router-link
    >
     router-link中to的对象写法 可以通过路由的name属性来设置路由地址
    <router-link :to="{ name: 'music' }"> music </router-link>
    <router-link :to="{ name: 'news' }"> news </router-link> -->
    <router-view></router-view>
  </div>
</template>

<script>
export default {
  name: "Home",
  beforeCreate() {
    console.log("---beforeCreate----");
  },
  created() {
    console.log("---created----");
  },
  beforeMount() {
    console.log("---beforeMount----");
  },
  mounted() {
    console.log("---mounted----");
  },

  beforeUpdate() {
    console.log("--home中的-beforeUpdate----");
  },
  updated() {
    console.log("--home中的updated----");
  },

  beforeDestroy() {
    console.log("---beforeDestroy----");
  },
  destroyed() {
    console.log("---destroyed----");
  },
};
</script>

<style>
</style>